<?php

$api = app('Dingo\Api\Routing\Router');

$api->version('v1', ['middleware' => 'api'], function ($api) {
    // 无需登录操作处理的路由组
    $api->group(['namespace' => 'Project\Product\Controllers', 'prefix' => 'product'], function ($api) {
        $api->resource('/cate', 'CategoryController');// 注意：继承的controller是App\Http\Controllers\Controller
    });

    // 需要登录操作处理的路由组(登录检验1.中间件 2.继承的BaseController类)
    $api->group(['namespace' => 'Project\Product\Controllers', 'middleware' => 'admin.auth', 'prefix' => 'product'], function ($api) {
        $api->resource('/index', 'IndexController');// 注意：继承的controller是Project\Admin\Controllers\BaseController
    });
});